package com.resource.authoritymanage.config;


import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

//申请状态枚举类
@Getter
@AllArgsConstructor
public enum ApplyStatusEnum {

    APPLYING("1","申请中"),
    ACCESS("2","已通过"),
    REJECTED("3","已驳回"),
    PEND_APPLY("4","待申请");
    private String code;
    private String name;


    public static String parseName(String code){
        Optional<String> optional = Arrays.stream(values()).filter(item -> Objects.equals(code, item.getCode())).findFirst()
                .map(item -> item.getName());
        return optional.isPresent() ? optional.get() : null;}
}
